package com.ksyun.cloudhostalarmprocessing.service;

import com.ksyun.cloudhostalarmprocessing.entity.Alerts;
import com.ksyun.cloudhostalarmprocessing.entity.Metrics;
import com.ksyun.cloudhostalarmprocessing.entity.Rules;

import java.util.List;

/**
 * <p>
 *  实时计算
 * </p>
 *
 * @author 李厚航
 * @since 2024-05-06
 */
public interface RealTimeComputingService {

    /**
     * 实时计算判断是否出现问题
     * @param metrics
     * @return
     */
    void calculate(List<Metrics> metrics);

    /**
     * 处理告警
     * @param alerts
     * @return
     */
    void action(List<Alerts> alerts);

    /**
     * 宕机判断
     * @param metrics
     * @return
     */
    Boolean downTime(Metrics metrics,Rules rules);

    /**
     * 主机连接数过高判断
     * @param metrics
     * @return
     */
    Boolean theNumberOfHostConnectionsIsTooHigh(Metrics metrics,Rules rules);

    /**
     * 磁盘空间剩余不足判断
     * @param metrics
     * @return
     */
    Boolean insufficientDiskSpaceRemaining(Metrics metrics,Rules rules);

    /**
     * 5分钟内cpu负载过高判断
     * @param metrics
     * @return
     */
    Boolean cpuLoadTooHighWithinFiveMinutes(Metrics metrics,Rules rules);

    /**
     * 空间内存过低判断
     * @param metrics
     * @return
     */
    Boolean lowSpaceAndMemory(Metrics metrics,Rules rules);
}
